package com.sanpu.kxe.module.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;

import com.sanpu.kxe.R;
import com.sanpu.kxe.business.main.provider.IMainProvider;
import com.sanpu.kxe.common.interfaces.UrlConstants;
import com.sanpu.kxe.rxservice.RequestMap;
import com.sanpu.kxe.utils.PublicProviderUtil;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Description：境外购弹框
 * Created by 薛勇军 on 2018/8/6.
 */

public class OverSeasPopupView extends Dialog {

    private Context mContext;

    public OverSeasPopupView(Context context) {
        super(context, R.style.dialog_normal);
        mContext = context;
        setContentView(R.layout.popup_overseas);
        ButterKnife.bind(this);
        setCancelable(false);
    }

    @OnClick({R.id.btnShop, R.id.closeIv})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btnShop:
                RequestMap map = new RequestMap();
                map.put("p_typ", "OVERSEASPAY");
                map.put("t_amt", "0");
                String url = UrlConstants.QUICKWEBPAYMENT + "?" + map.map2ReqStr();
                IMainProvider provider = PublicProviderUtil.getProvider(IMainProvider.class);
                if (provider != null) {
                    provider.openBrowserX5Activity(mContext, url, true);
                }
                dismiss();
                break;
            case R.id.closeIv:
                dismiss();
                break;
        }
    }
}
